//
//  ComboBox.h
//  YYZB
//
//  Created by 顾悦 on 6/30/15.
//  
//

#import <UIKit/UIKit.h>

static const NSString *defaultCodeFieldName = @"Code";
static const NSString *defaultTitleFieldName = @"Title";

@interface ComboBox : UIButton

/**
 
 Code-Title pairs.
 Code and Title.
 
 */
@property (strong, nonatomic) NSArray *dataSource;

/**
 
 Whether options shown.
 
 */
@property (getter=isDropped, nonatomic) BOOL dropped;

+ (instancetype)comboBoxWithDataSource:(NSArray *)dataSource
                                  code:(NSString *)code
                                 title:(NSString *)title
                                 frame:(CGRect)frame
                            completion:(void (^)(NSString *selectedCode, NSString *selectedTitle))completion;

+ (instancetype)comboBoxWithDataSource:(NSArray *)dataSource
                                 frame:(CGRect)frame
                            completion:(void (^)(NSString *selectedCode, NSString *selectedTitle))completion;

@end
